<?php
include_once '../util/db/service/PreorderListDBUtil.php';
?>
<?php 
$year = $_POST["year"];
$month = $_POST["month"];
$cm_id = $_POST["cm_id"];
$sb_id = $_POST["sb_id"];
$status = $_POST["status"];
//echo $cm_id;
$orderListSearchPara = new OrderListSearchPara();
$orderListSearchPara->setSb_id($sb_id);
$orderListSearchPara->setMonth($month);
$orderListSearchPara->setYear($year);
$orderListSearchPara->setStatus($status);
$preorderListDBUtil = new PreorderListDBUtil ();
$preorderDetailArray = $preorderListDBUtil->queryPreorderDetail($orderListSearchPara);

//$companyMemberDAO = new CompanyMemberDAO();
//$companyMember = $companyMemberDAO.queryById($cm_id);
//$company = $companyMember->get(0)->get("company");
$sql = "select * from company_member where 0=0 and cm_id=$cm_id";
$result = @mysql_query ( $sql );
$company = "";
while ( $row = @mysql_fetch_array ( $result ) ) {
	$company =  $row["company"];
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/admin_page.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>進退貨記錄</title>
<!-- InstanceEndEditable -->
<style type="text/css">
<!--
#cantainer {
	width: 955px;
	margin-right: 33px;
	margin-left: 33px;
}
#header {
	width: 955px;
	margin-bottom: 10px;
	background-image: url(../../images/top_bg.png);
	height: 82px;
}
#body {
	width: 955px;
	margin-bottom: 10px;
}
#footer {
	width: 955px;
}
.style2 {color: #666666;
	font-size: 12px;
}
#contant_list {
	float: left;
	width: 180px;
	margin-right: 10px;
}
.style17 {color: #74B9E5; font-size: 14px; }
.style43 {font-size: 12px; color: #666666; font-weight: bold; }
#contant_body {
	float: right;
	width: 765px;
}
-->
</style>
<!-- InstanceBeginEditable name="head" -->
<style type="text/css">
<!--
#contant_body_header {
	background-image: url(../images/admin_supplier_inventory_in_history_header.png);
	height: 62px;
	width: 765px;
	margin-bottom: 10px;
}
#contant_body_body {
	width: 765px;
	margin-bottom: 10px;
}
.style4 {font-size: 12px}
#contant_body_1_1 {width: 737px;
	margin-right: 10px;
	margin-bottom: 10px;
	margin-left: 10px;
}
#contant_body_1_2 {width: 737px;
	margin-right: 10px;
	margin-bottom: 10px;
	margin-left: 10px;
}
#contant_body_1_text {
	height: 25px;
	width: 737px;
	margin-right: 10px;
	margin-bottom: 10px;
	margin-left: 10px;
	background-image: url(../images/admin_supplier_inventory_in_history_text.png);
}
#contant_body_1_1_1 {
	width: 737px;
	margin-bottom: 10px;
	margin-right: 10px;
	margin-left: 10px;
}
-->
</style>
<!-- InstanceEndEditable -->
<script src="/shopping/shopcarda2/admin/js/jquery.js"></script>
<script src="/shopping/shopcarda2/admin/js/jquery.tablePagination.0.2.min.js"></script>
<script>
$(document).ready(function () {
	$("#table1").tablePagination(); 
});
</script>
</head>

<body>
<table width="1024" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><div id="cantainer">
      <div id="header"></div>
      <div id="body">
        <div id="contant_list">
          <table border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
              <td align="center"><img src="../../images/index_12.png" width="180" height="54" /></td>
            </tr>
            <tr>
              <td><?php include_once '../common/menu.php';?></td>
            </tr>
            <tr>
              <td width="180" height="28" align="center"><table width="0" border="0" align="center" cellpadding="0" cellspacing="0">
                  <tr>
                    <td width="180" height="28" align="center"><img src="../../images/index_20.png" width="180" height="28" /></td>
                  </tr>
              </table></td>
            </tr>
          </table>
        </div>
        <!-- InstanceBeginEditable name="EditRegion1" -->
        <div id="contant_body">
          <div id="contant_body_header"></div>
          <div id="contant_body_body">
            <table cellpadding="0" cellspacing="0">
              <tr>
                <td colspan="3"><img src="../../member/img/member_body_up.jpg" width="765" height="9" /></td>
              </tr>
              <tr>
                <td width="4" background="../../member/img/member_body_left.jpg">&nbsp;</td>
                <td width="757"><div id="contant_body_1_text"></div>
                    <div id="contant_body_1_1">
                      <table id="table1" width="737" cellspacing="0" cellpadding="5">
                        <tr>
                          <td width="90" align="center" bgcolor="#F1F1F1" class="style4">訂單號碼</td>
                          <td align="center" bgcolor="#F1F1F1" class="style4">進貨日期</td>
                          <td align="center" bgcolor="#F1F1F1" class="style4">商品名稱</td>
                          <td align="center" bgcolor="#F1F1F1" class="style4">供應商</td>
                          <td align="center" bgcolor="#F1F1F1" class="style4">品牌</td>
                          <td align="center" bgcolor="#F1F1F1" class="style4">販售方式</td>
                          <td align="center" bgcolor="#F1F1F1" class="style4">商品尺寸</td>
                          <td align="center" bgcolor="#F1F1F1" class="style4">商品數量</td>
                          <td align="center" bgcolor="#F1F1F1" class="style4">商品金額</td>
                          <td align="center" bgcolor="#F1F1F1" class="style4">商品狀態</td>
                        </tr>
                        <tr>
                          <td colspan="10" align="center" class="style4">
                          <?php for($i = 0; $i < $preorderDetailArray->size (); $i ++) {
							$preorderDetail = $preorderDetailArray->get($i);
							?>
                          <table width="100%" cellspacing="0" cellpadding="0">
                              <tr>
                                <td width="13%" class="style4" align="center"><a href="admin_inventory_inper_ifor.php?pd_id=<?php echo $preorderDetail->getPd_id ()?>"><?php echo $preorderDetail->getPreorderList()->getPreorder_no ();?></a></td>
                                <td width="11%" class="style4" align="center"><?php echo $preorderDetail->getPreorderList()->getPreorder_date();?></td>
                                <td width="10%" class="style4" align="center"><?php echo $preorderDetail->getProduct()->getP_name ();?></td>
                                <td width="8%" class="style4" align="center"><?php echo $company?></td>
                                <td width="7%" class="style4" align="center"><?php echo $preorderDetail->getPreorderList()->getSupplierBrand()->getLogo_name ();?></td>
                                <td width="10%" class="style4" align="center"><?php echo $preorderDetail->getProduct()->getSell_mode ();?></td>
                                <td width="10%" class="style4" align="center"><?php echo $preorderDetail->getProdAttr ()->getAttr ();?></td>
                                <td width="10%" class="style4" align="center"><?php echo $preorderDetail->getCount ();?></td>
                                <td width="11%" class="style4" align="center">NT$<?php echo number_format($preorderDetail->getPrice()*$preorderDetail->getCount())?></td>
                                <td width="10%" class="style4" align="center"><?php echo $preorderListDBUtil->genStatusDesc($preorderDetail->getStatus())?></td>
                              </tr>
                            </table>
                            <?php }?>
                            </td>
                        </tr>
                      </table>
                    </div>
                    <div id="contant_body_1_1_1">
                      <table width="737" cellspacing="0" cellpadding="5">
                        <tr>
                          <td align="right" class="style4"><a href="javascript: window.print();">表單列印</a>　<a href="admin_inventory_inhistory_export.php?export=1&year=<?php echo $year?>&month=<?php echo $month?>&cm_id=<?php echo $cm_id?>&sb_id=<?php echo $sb_id?>&status=<?php echo $status?>">Excel檔匯出</a></td>
                        </tr>
                      </table>
                    </div>
                    </td>
                <td width="4" background="../../member/img/member_body_right.jpg">&nbsp;</td>
              </tr>
              <tr>
                <td height="9" colspan="3"><img src="../../member/img/member_body_down.jpg" width="765" height="9" /></td>
              </tr>
            </table>
          </div>
        </div>
        <!-- InstanceEndEditable --></div>
      <?php include_once '../common/footer.php';?>
      </div></td>
  </tr>
</table>
</body>
<!-- InstanceEnd --></html>